/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AlwaysOnCluster;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.account.accesscontrol.TargetType;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CreateAlwaysOnCluster
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 39 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 40 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 42 */     String name = request.getAttribute("name").toLowerCase();
/* 43 */     Map<String, Object> attrs = AdminService.getAttrs(request, true);
/*    */     
/* 45 */     checkRight(zsc, context, null, Rights.Admin.R_createAlwaysOnCluster);
/* 46 */     checkSetAttrsOnCreate(zsc, TargetType.alwaysoncluster, name, attrs);
/*    */     
/* 48 */     AlwaysOnCluster cluster = prov.createAlwaysOnCluster(name, attrs);
/*    */     
/* 50 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "CreateAlwaysOnCluster", "name", name }, attrs));
/*    */     
/*    */ 
/* 53 */     Element response = zsc.createElement(AdminConstants.CREATE_ALWAYSONCLUSTER_RESPONSE);
/* 54 */     GetAlwaysOnCluster.encodeCluster(response, cluster);
/*    */     
/* 56 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 61 */     relatedRights.add(Rights.Admin.R_createAlwaysOnCluster);
/* 62 */     notes.add(String.format("All attrs provided in the attribute list have to settable by. the authed admin.   You can grant the %s right, which allows setting all attributes on %s, or grant the set attrs right just for the attributes the admin needs to set while creating an entry.", new Object[] { Rights.Admin.R_createAlwaysOnCluster.getName(), "alwaysOnCluster" }));
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/CreateAlwaysOnCluster.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */